import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// 引入全局自定义css
import '@/styles/index.scss'
import App from './App.vue'
import router from './router'
import store from './store'
import '@/assets/icon/iconfont.css'
import VueCookies from 'vue-cookies'
import VueRouter from 'vue-router'
import 'windi.css'
import NProgress from 'nprogress' // 进度条
import 'nprogress/nprogress.css' // 这个样式必须引入
import permission from './utils/permission'
// 注册全局指令
Vue.directive('permission', permission)
Vue.use(VueRouter)
Vue.use(VueCookies, { expire: '1d' })
Vue.use(ElementUI, { size: 'medium' })
Vue.config.productionTip = false
NProgress.inc(0.2)
NProgress.configure({ easing: 'ease', speed: 300, showSpinner: false })
// 在进入路由前置守卫中，现开始进度条，在通过。
router.beforeEach((to, from, next) => {
  NProgress.start() // 开始
  next()
})
// 全局后置首位中结束进度条
router.afterEach(() => {
  NProgress.done()// 结束
})
// console.log(process.env.VUE_APP_BASE_URL)
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
